﻿@model WeProjectsModel.Notice

<style type="text/css">
    section.container form > div {
        margin-top: 10px;
        margin-bottom: 10px;
    }
</style>

@{
    ViewBag.Title = "Edit";
    if (!Roles.IsUserInRole("sysadmin"))
    {
        Response.Write("您没有权限操作!");
        Response.End();
    }
}
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<script type="text/javascript" charset="utf-8" src="lang/zh-cn/zh-cn.js"></script>

<h2>编辑通知</h2>

<p class="buttonIn">
    @Html.ActionLink("返回列表", "Index")
</p>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    
    @*<table class="table">
        <tr>
            <td class="active width-20p">标题</td>
            <td>
                <input type="hidden" name="ID" value="@Html.ViewContext.RouteData.Values["id"]" />
                @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <td class="active width-20p">正文</td>
            <td>
                <script id="editor" type="text/plain" style="width:100%;height:300px;">
                </script>
                <input type="hidden" id="NewsContent" name="NewsContent" />
            </td>
        </tr>
    </table>*@
    <div class="form-group">
        <label class="control-label width-40p">标题</label>
        <input type="hidden" name="ID" value="@Html.ViewContext.RouteData.Values["id"]" />
        @Html.EditorFor(model => model.Title)
        @Html.ValidationMessageFor(model => model.Title)
    </div>
    <div class="form-group">
        <label class="control-label width-40p" style="vertical-align:top;">内容</label>
        <div style="display:inline-block;overflow:hidden;zoom:1;width:90%">
            <script id="editor" type="text/plain" style="width:100%;height:300px;">
            </script>
            <input type="hidden" id="NewsContent" name="NewsContent" />
        </div>
    </div>
    <div class="form-group">
        <label class="control-label width-40p"></label>
        <input type="submit" value="保存" class="btn btn-success" />
    </div>
}
@*<script src="~/Scripts/jquery-1.9.0.js"></script>*@
<script type="text/javascript">
    var ue = UE.getEditor('editor');
    ue.ready(function () {
        var content = '@Html.Raw(Model.NoticeContent)';
        ue.setContent(content);
    });
    $('form').submit(function () {
        $('#NewsContent').val(ue.getContent());
    });
</script>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
